﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Reporting.API.Application.Commands.ForeignKey;
using Reporting.Errorcode;

namespace Reporting.API.Controllers
{
    /// <summary>
    /// 外健--API
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ForeignKeyController : ControllerBase
    {
        private readonly IMediator _mediator;

        public ForeignKeyController(IMediator mediator)
        {
            _mediator = mediator;
        }
        /// <summary>
        /// 产品类型 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult> GetProductType([FromQuery] ProductTypeCommond request)
        {
            return await _mediator.Send(request);
        }

        /// <summary>
        /// 来源类型 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult> GetForeignKey([FromQuery] ForeignKeyCommond request)
        {
            return await _mediator.Send(request);
        }

        /// <summary>
        /// 开、收票方 （公司名称）
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult> GetPayeeForeignKey([FromQuery] PayeeCommond request)
        {
            return await _mediator.Send(request);
        }

        /// <summary>
        ///  发票类型 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiResult> GetInvoicetypeForeignKey([FromQuery] InvoicetypeCommond request)
        {
            return await _mediator.Send(request);
        }

    }
}
